 %!TEX program = xelatex
\documentclass[lang=cn,10pt]{elegantbook}

% 本文档命令
\usepackage{array,url}
\newcommand{\ccr}[1]{\makecell{{\color{#1}\rule{1cm}{1cm}}}}
\newcommand{\code}[1]{\lstinline{#1}}


% 文档区
\begin{document}

\chapter*{数值分析作业--Week3}

\begin{problem}
考虑$s\in\mathbb{S}_3^2, x\in[0,2]$并且
\[s(x) = \begin{cases} p(x) \quad x\in [0,1] \\ (2-x)^3 \quad x\in [1,2]
\end{cases}
\]
求$p\in\mathbb{P}_3$使得$s(0)=0$，$s(x)$是一个NC样条吗？

\end{problem}
\begin{proof}
设 
\[p(x) = a_0 + a_1 x + a_2 x^2 + a_3 x^3\]
由于$p(0)=0$，有$a_0=0$，又
\[\begin{aligned}
p(1) &= a_1 + a_2 + a_3 = (2-1)^3 = 1 \\
p'(1) &=  a_1 + 2a_2 + 3a_3 = -3\times(2-1)^2 = -3  \\ 
p''(1) &= 2a_2 + 6a_3 = 6\times(2-1) = 6 
\end{aligned}\]
解得$a_1 =12 , a_2 = -18, a_3 = 7$，即
\[p(x) = 12x - 18x^2 + 7x^3\]
注意到$s''(0) = p''(0) = -36 \neq 0$ ,故$s$不是NC样条。
\end{proof}
\vspace{1.5em}
\begin{problem}
对$f_i = f(x_i)$在点$a=x_1<x_2<\cdots <x_n=b$上的标量函数，考虑$f$在$[a,b]$上的二次样条$s\in\mathbb{S}_2^1$的插值，回答以下问题：\par
(a)为什么还需要一个条件来唯一确定$s$?\par
(b)记$m_i = s'(x_i)$以及$p_i = s|{[x_i,x_{i+1}]}$，求解$p_i$用$f_i,f_{i+1}$与$m_i$的形式表示($1\leq i \leq n-1$)。\par 
(c)假设$m_1 = f'(a)$，显示$m_2,m_3,\cdots, m_{n-1}$是如何被计算的。
\end{problem}
\begin{proof}
(a)注意到$\mathbb{S}_{2,n}^1$是一个$n+1$维线性空间，给定$f_i$相当于$n$个约束，故无法唯一确定$s$。\\
(b)设
\[p_i(x) = a_[i,0] + a_[i,1] x +a_[i,2]x^2\]
我们有
\[\begin{aligned}
p_i(x_i) &= a_{i,0} + a_{i,1}x_i + a_{i,2}x_i^2 = f_i \\
p_i(x_{i+1}) &= a_{i,0} + a_{i,1}x_{i+1} + a_{i,2}x_{i+1}^2 = f_{i+1} \\
p_i'(x_i) &= a_{i,1} + 2a_{i,2}x_i = m_i \\
\end{aligned}\]
从而有
\[\begin{aligned}
a_{i,0} &= \dfrac{f_ix_{i+1}^2+f_{i+1}x_i^2-2f_ix_ix_{i+1}}{(x_{i+1}-x_i)^2} -\dfrac{m_ix_ix_{i+1}}{x_{i+1}-x_i}\\
a_{i,1} &= \dfrac{m_i(x_{i+1}^2-x_i^2)-2x_i(f_{i+1}-f_i)}{(x_{i+1}-x_i)^2} \\
a_{i,2} &= \dfrac{(f_{i+1}-f_i)-m_i(x_{i+1}-x_{i})}{(x_{i+1}-x_i)^2} \\
\end{aligned}\]
综上，有
\[p_i(x) = \dfrac{f_ix_{i+1}^2+f_{i+1}x_i^2-2f_ix_ix_{i+1}}{(x_{i+1}-x_i)^2} -\dfrac{m_ix_ix_{i+1}}{x_{i+1}-x_i}+ \dfrac{m_i(x_{i+1}^2-x_i^2)-2x_i(f_{i+1}-f_i)}{(x_{i+1}-x_i)^2}x + \dfrac{(f_{i+1}-f_i)-m_i(x_{i+1}-x_{i})}{(x_{i+1}-x_i)^2}x^2\]
(c)应用(b)的结论，我们总是有
\[
\begin{aligned}
p_i'(x_{i+1}) &= \dfrac{m_i(x_{i+1}^2-x_i^2)-2x_i(f_{i+1}-f_i)}{(x_{i+1}-x_i)^2} + 2x_{i+1}\dfrac{(f_{i+1}-f_i)-m_i(x_{i+1}-x_{i})}{(x_{i+1}-x_i)^2} \\
& = \dfrac{m_{i+1}(x_{i+2}^2-x_{i+1}^2)-2x_{i+1}(f_{i+2}-f_{i+1})}{(x_{i+2}-x_{i+1})^2} + 2x_{i+1}\dfrac{(f_{i+2}-f_{i+1})-m_{i+1}(x_{i+2}-x_{i+1})}{(x_{i+2}-x_{i+1})^2} = p_{i+1}'(x_{i+1})
\end{aligned}
\]
上式等价于
\[m_{i+1} + m_i =  2f_{[x_i,x_{i+1}]}\]
其中$f_{[x_i,x_{i+1}]} = \dfrac{f_{i+1}-f_i}{x_{i+1}-x_i}$，从而得到
\[\begin{cases}
m_{2k+1} = f'(a) + 2\sum\limits_{i=1}^k (f_{[x_{2k+1},x_{2k}]}-f_{[x_{2k},x_{2k-1}]}) \\
m_{2k} = -f'(a) + 2f_{[x_{2k+1},x_{2k}]} - 2\sum\limits_{i=1}^k (f_{[x_{2k+1},x_{2k}]}-f_{[x_{2k},x_{2k-1}]}) \\
\end{cases}
\]其中$k\in\mathbb{N}$，即能够计算$m_i$。
\end{proof}
\vspace{1.5em}
\begin{problem}
令$s_1(x) = 1+c(x+1)^3$，其中$x\in[-1,0]$并且$c\in\mathbb{R}$，在$[0,1]$求$s_2(x)$使得
\[
s(x) = \begin{cases}
s_1(x)\quad x\in [-1,0] \\
s_2(x)\quad x\in [0,1] \\
\end{cases}
\]
是一个$[-1,1]$上以$-1,0,1$为结点的NC样条。若要令$s(1)=-1$，则应当选取什么样的$c$？
\end{problem}
\begin{proof}
由于$s\in\mathbb{S}_3^2，因此s_2 = s|_{[0,1]} \in \mathbb{P}_3$，设
\[s_2(x) = a_0 + a_1x + a_2 x^2 +a_3 x^3\]
我们有
\[
\begin{aligned}
s_2(0) &= a_0 = s_1(0) = 1+c \\
s_2'(0) &= a_1 = s_1'(0) = 3c \\ 
s_2''(0) &= 2a_2 = s_1''(0) = 6c \\
s_2''(1) &= 2a_2 +6a_3 = 0 \\
\end{aligned}
\]
综上可得
\[s_2(x) = 1+c +3cx + 3cx^2 -cx^3\]
若$s(1)=-1$，则
\[-1 = s(1) = s_2(1) = 6c + 1\]
故此时$c=-\dfrac{1}{3}$。
\end{proof}
\vspace{1.5em}

\begin{problem}
令$f(x)=\cos(\tfrac{\pi}{2}x)$，其中$x\in [-1,1]$，解决下列问题：\par
(a)求以$-1,0,1$为结点的关于$f$的NC样条。\par
(b)NC样条有最小弯曲能量，取$g(x)$为对于$f$与$-1,0,1$二次插值公式与$f(x)$分别验证这个结论。
\end{problem}
\begin{proof}
(a)设 $p_1(x) = s|_{[-1,0]}, p_2 = s|_{[0,1]}$，令
\[\begin{aligned}
p_1(x) &= a_{1,0} + a{1,1}x + a_{1,2} x^2 + a_{1,3} x^3 \\ 
p_2(x) &= a_{2,0} + a{2,1}x + a_{2,2} x^2 + a_{2,3} x^3 \\
\end{aligned}
\]
显然我们有
\[
\begin{aligned}
p_1''(-1) &= 2a_{1,2} - 6a_{1,3} = 0 \\ 
p_2''(1) &= 2a_{2,2} + 6a_{2,3} = 0 \\
p_1(-1) &= a_{1,0} - a_{1,1} + a_{1,2} - a_{1,3}= f(-1) = 0 \\
p_2(1) &= a_{2,0} + a_{2,1} + a_{2,2} + a_{2,3}= f(1) = 0 \\
p_1(0) &= a_{1,0} = 1 \\
p_2(0) &= a_{2,0} = 1 \\
p_1’(0) &= a_{1,1} = a_{2,1} = p_2'(0) \\
p_1''(0) &= 2a_{1,2} = 2a_{2,2} = p_2''(0) \\
\end{aligned}
\]
综上所述，解得
\[
\begin{aligned}
p_1(x) &= 1 - \tfrac{3}{2}x^2 - \tfrac{1}{2} x^3 \\ 
p_2(x) &= 1 - \tfrac{3}{2}x^2 + \tfrac{1}{2} x^3 \\
\end{aligned}
\]
从而$s(x)$使得$s|_{[-1,0]} = p_1(x), s|_{[0,1]} = p_2(x)$即为所求。\\
(b)
\[\int_{-1}^1 [s''(x)]^2dx = \int_{-1}^0 (-3-3x)^2dx + \int_0^1 (-3+3x)^2dx = 6\]
由Newton公式我们可以得到所求的二次插值为
\[q(x) = x-x^2\]
从而
\[\int_{-1}^1 [q''(x)]^2 dx = 8 > 6\]
取$g(x)=f(x)$有
\[\int_{-1}^1 [f''(x)]^2 dx = \int_{-1}^1 \dfrac{\pi^4}{16}\cos^2(\tfrac{\pi}{2}x) dx = \dfrac{\pi^4}{16} > 6\]
综上即证。
\end{proof}
\vspace{1.5em}

\begin{problem}
代数形式地验证定理3.32的$n=2$情况，即
\[(t_{i+2}-t_{i-1})[t_{i-1},t_{i},t_{i+1},t_{i+2}](t-x)_+^2 = B_i^2\]
\end{problem}
\begin{proof}
\[\begin{aligned}
B_i^2(x) &= \dfrac{x-t_{i-1}}{t_{i+1}-t_{i-1}}B_i^1(x) + \dfrac{t_{i+2}-x}{t_{i+2}-t_i}B_{i+1}^1(x) \\
&= \dfrac{x-t_{i-1}}{t_{i+1}-t_{i-1}}(\dfrac{x-t_{i-1}}{t_{i}-t_{i-1}}B_i^0+\dfrac{t_{i+1}-x}{t_{i+1}-t_i}B_{i+1}^0(x))+\dfrac{t_{i+2}-x}{t_{i+2}-t_i}(\dfrac{x-t_{i}}{t_{i+1}-t_{i}}B_{i+1}^0+\dfrac{t_{i+2}-x}{t_{i+2}-t_{i+1}}B_{i+2}^0(x)) \\ 
&=\dfrac{x-t_{i-1}}{t_{i+1}-t_{i-1}}((x-t_{i-1})[t_i,t_{i-1}](t-x)_+^0+(t_{i+1}-x)[t_{i+1},t_i](t-x)_+^0) \\ &+\dfrac{t_{i+2}-x}{t_{i+2}-t_i}((x-t_{i})[t_{i+1},t_{i}](t-x)_+^0+(t_{i+2}-x)[t_{i+2},t_{i+1}](t-x)_+^0) \\ 
& = \dfrac{x-t_{i-1}}{t_{i+1}-t_{i-1}}((t_{i-1}-x)([t_{i+1},t_i](t-x)_+^0-[t_i,t_{i-1}](t-x)_+^0)+(t_{i+1}-t_{i-1})[t_{i+1},t_i](t-x)_+^0) \\
&+\dfrac{t_{i+2}-x}{t_{i+2}-t_i}((t_{i}-x)([t_{i+2},t_{i+1}](t-x)_+^0-[t_{i+1},t_{i}](t-x)_+^0)+(t_{i+2}-t_{i})[t_{i+2},t_{i+1}](t-x)_+^0) \\
&= (x-t_{i-1})[t_{i-1},t_i,t_{i+1}](t-x)_+^0 + (t_{i+2}-x)[t_{i},t_{i+1},t_{i+2}](t-x)_+^0 \\
&= (t_{i+2}-t_{i-1})[t_{i-1},t_{i},t_{i+1},t_{i+2}](t-x)_+^2
\end{aligned}\]
证毕。
\end{proof}
\vspace{1.5em}


\begin{problem}
对于二次B样条$B_i^2(x)$，回答如下问题：\par
(a)给出$B_i^2(x)$的具体表达式\par
(b)验证$\tfrac{d}{dx}B_i^2(x)$在$t_i,t_{i+1}$是连续的\par
(c)证明仅存在唯一$x^*\in(t_{i-1},t_{i+1})$满足$\tfrac{d}{dx}B_i^2(x^*)=0$，用支持区间中结点的形式表示$x^*$\par
(d)证明$B_i^2(x)\in[0,1)$\par
(f)对$t_i=i$，做出$B_i^2(x)$的图。
\end{problem}
\begin{proof}
(a)我们有
\[B_i^1(x) = \hat{B_i}(x) = \begin{cases}
\dfrac{x-t_{i-1}}{t_i-t_{i-1}}\quad x\in(t_{i-1},t_i] \\
\dfrac{t_{i+1}-x}{t_{i+1}-t_{i}}\quad x\in(t_{i},t_{i+1}] \\
0 \quad else\\
\end{cases}
\]
且
\[B_i^2(x) = \dfrac{x-t_{i-1}}{t_{i+1}-t_{i-1}}B_i^1(x) + \dfrac{t_{i+2}-x}{t_{i+2}-t_i}B_{i+1}^1(x)\]
从而有
\[
B_i^2(x) = \begin{cases}
\dfrac{(x-t_{i-1})^2}{(t_{i+1}-t_{i-1})(t_i-t_{i-1})}  \quad x\in(t_{i-1},t_i],\\
\\
\dfrac{(x-t_{i-1})(t_{i+1}-x)}{(t_{i+1}-t_{i-1})(t_{i+1}-t_i)}+\dfrac{(t_{i+2}-x)(x-t_i)}{(t_{i+2}-t_{i})(t_{i+1}-t_{i})} \quad x\in(t_i,t_{i+1}],\\
\\
\dfrac{(t_{i+2}-x)^2}{(t_{i+2}-t_{i})(t_{i+2}-t_{i+1})} \quad  x\in(t_{i+1},t_{i+2}],\\
\\
0 \quad else \\
\end{cases}
\]
(b)根据上面计算，容易知道
\[\tfrac{d}{dx}B_i^2(x) = \begin{cases}
\dfrac{2(x-t_{i-1})}{(t_{i+1}-t_{i-1})(t_i-t_{i-1})}  \quad x\in(t_{i-1},t_i],\\
\\
\dfrac{(t_{i+1}-x)-(x-t_{i-1})}{(t_{i+1}-t_{i-1})(t_{i+1}-t_i)}+\dfrac{(t_{i+2}-x)-(x-t_i)}{(t_{i+2}-t_{i})(t_{i+1}-t_{i})} \quad x\in(t_i,t_{i+1}],\\
\\
\dfrac{-2(t_{i+2}-x)}{(t_{i+2}-t_{i})(t_{i+2}-t_{i+1})} \quad  x\in(t_{i+1},t_{i+2}],\\

\end{cases}\]
从而
\[\tfrac{d}{dx}B_i^2(t_i) = \dfrac{2}{t_{i+1}-t_{i-1}}=\lim\limits_{x\to t_i^+}\big(\dfrac{(t_{i+1}-x)-(x-t_{i-1})}{(t_{i+1}-t_{i-1})(t_{i+1}-t_i)}+\dfrac{(t_{i+2}-x)-(x-t_i)}{(t_{i+2}-t_{i})(t_{i+1}-t_{i})}\big)\]
\end{proof}
并且
\[\tfrac{d}{dx}B_i^2(t_{i+1}) = \dfrac{2}{t_i-t_{i+2}} = \lim\limits_{x\to t_{i+1}^+}\dfrac{-2(t_{i+2}-x)}{(t_{i+2}-t_{i})(t_{i+2}-t_{i+1})} \]
即证。\\
(c)上一问中我们得知$\tfrac{d}{dx}B_i^2(x)$是分段线性函数并且
\[\tfrac{d}{dx}B_i^2(t_{i-1})=\tfrac{d}{dx}B_i^2(t_{i+2})=0,\quad \tfrac{d}{dx}B_i^2(t_i) >0 ,\quad \tfrac{d}{dx}B_i^2(t_{i+1})<0 \]
所以显然只有
\[x^*=\frac{t_{i+2}t_{i+1}-t_it_{i-1}}{(t_{i+2}+t_{i+1})-(t_i+t_{i-1})}\]
是满足条件的，即证。
(d) 根据上一问有
\[\tfrac{d}{dx}B_i^2(x) >0 x\in(t_{i-1},x^*] \qquad \tfrac{d}{dx}B_i^2(x) <0 x\in(x^*,t_{i+2}]\]
故最大值在$x=x^*$有
\[B^2_i(x^*) < 1 \]
取到，在$t_{i-1},t_{i+2}$取到最小值(显然$t_{i-1}$是可延拓的)，有
\[B^2_i(t_{i-1}) = B^2_i(t_{i+2}) = 0\]
即$B_i^2(x)\in[0,1)$。\\
(e)取$i=0$有如下图像：
\begin{figure}[htbp]
    \centering
    \includegraphics[width=0.5\textwidth]{"png/B_2.png"}
\end{figure}
此外，注意到若$t_i=i$，则$\tfrac{d}{dx}B_i^2(x)$的图像在取不同的$i$时是显然的平移变换，因此我们可以预测图像一定呈周期性变化：
\begin{figure}[htbp]
    \centering
    \includegraphics[width=0.5\textwidth]{"png/B_p.png"}
\end{figure}
与我们期望一致。

\vspace{1.5em}

\begin{problem}
利用B样条导数定理证明B样条$B_i^n(x)$在其支持域上的积分与指标无关，并且当结点不均匀分布时仍然成立。
\end{problem}
\begin{proof}
根据导数定理，
\[
\begin{aligned}
\int_{t_{i-1}}^{t_{i+n+1}} B_i^n(x) dx &= \int_{t_{i-1}}^{t_{i+n}} \dfrac{d B_i^{n+1}(x)}{dx} dx \\
&=\dfrac{n+1}{t_{i+n}-t_{i-1}} \int_{t_{i-1}}^{t_{i+n}} B_i^n(x) dx
-\dfrac{n+1}{t_{i+n+1}-t_{i}} \int_{t_{i}}^{t_{i+n+1}} B_{i+1}^n(x) dx
\end{aligned}
\]
又
\[\int_{t_{i-1}}^{t_{i+n}} \dfrac{d B_i^{n+1}(x)}{dx} dx = B_i^{n+1}|^{t_{i+n+1}}_{t_{i-1}} = 0\]
从而
\[\dfrac{n+1}{t_{i+n}-t_{i-1}} \int_{t_{i-1}}^{t_{i+n}} B_i^n(x) dx
-\dfrac{n+1}{t_{i+n+1}-t_{i}} \int_{t_{i}}^{t_{i+n+1}} B_{i+1}^n(x) dx=0\]
即
\[\dfrac{1}{t_{i+n}-t_{i-1}} \int_{t_{i-1}}^{t_{i+n}} B_i^n(x) dx
=\dfrac{1}{t_{i+n+1}-t_{i}} \int_{t_{i}}^{t_{i+n+1}} B_{i+1}^n(x) dx\]
即证。
\end{proof}
\vspace{1.5em}

\begin{problem}
我们熟知有定理说明完全对称多项式可以表示成单项式的差分，有下面问题：
(a)用差分表的形式对$m=4,n=2$验证该定理。\par
(b)用完全对称多项式递推关系的引理证明该定理。
\end{problem}
\begin{proof}
(a)我们有如下差分表
\begin{center}
    \begin{tabular}{c|ccc}
         $x_i$     &  $x_i^4$     & \\
         $x_{i+1}$ &  $x_{i+1}^4$ & $x_i^3+x_i^2x_{i+1}+x_ix_{i+1}^2+x_{i+1}^3$\\
         $x_{i+2}$ &  $x_{i+2}^4$ & $x_{i+1}^3+x_{i+1}^2x_{i+2}+x_{i+1}x_{i+2}^2+x_{i+2}^3$ & $x_{i+1}^2+x_{i+1}x_{i+2}+x_{i+1}x_{i}+x_{i+2}^2+x_{i}^2+x_{i+2}x_i$\\
    \end{tabular}
\end{center}
显然定理在题目中的情况下成立。\\
(b)
对$m$施用数学归纳法，前面已经说明了$m=4$时结论成立，对于较低情况也都容易验证，下面证明$P(m)\implies P(m+1)$
\[
\begin{aligned}
\tau_{m+1-n}(x_i,\cdots,x_{i+n}) & = \tau_{m-(n-1)}(x_i,\cdots,x_{i+n-1}) + x_{i+n}\tau_{m-n}(x_i,\cdots,x_{i+n}) \\
& = [x_i,\cdots,x_{i+n-1}]x^m +x_{i+n} [x_i,\cdots,x_{i+n}]x^m \\
&= [x_i,\cdots, x_{i+n}]x^{m+1} \text{(Leibniz公式)}
\end{aligned}
\]
即证。
\end{proof}
\vspace{1.5em}
\newpage 

\end{document}
